<?php
$this->Paginator->options(array(
    'update' => '#content-outer',
    'evalScripts' => false
));

if(isset($this->request->data) && !empty($this->request->data)){
    $this->Paginator->options(array('url' => $this->request->data['Cashier']));
}
$pageOption = $this->Paginator->params();
?>
<div id="content">
    <div id="page-heading">
        <h1>Cashiers management <?php echo $this->Html->link("Add Cashier", array('controller' => $lN, 'action' => 'add', 'admin' => true),array('class'=>'button')); ?> </h1>
    </div>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
        <tr>
            <th rowspan="3" class="sized">
                <?php echo $this->Html->image('../images/shared/side_shadowleft.jpg', array('width' => '20', 'height' => '300', 'alt' => '')); ?>
            </th>
            <th class="topleft"></th>
            <td id="tbl-border-top">&nbsp;</td>
            <th class="topright"></th>
            <th rowspan="3" class="sized">
                <?php echo $this->Html->image('../images/shared/side_shadowright.jpg', array('width' => '20', 'height' => '300', 'alt' => '')); ?>
            </th>
	</tr>
	<tr>
            <td id="tbl-border-left"></td>
            <td>
                <div id="content-table-inner">
                    <?php echo $this->Session->flash();?>
                    <div id="table-content">
                        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                            <tr>
                                <th class="table-header-repeat line-left">
                                    Id
                                </th>
                                <th class="table-header-repeat line-left">
                                    Name
                                </th>
                                <th class="table-header-repeat line-left">
                                    Working days
                                </th>
                                <th class="table-header-repeat line-left">
                                    Working time
                                </th>
                                <th class="table-header-repeat line-left">
                                    Status
                                </th>
                                <th class="table-header-repeat line-left">
                                    Created
                                </th>
                                <th class="table-header-repeat line-left">Options</th>
                            </tr>
                            <?php 
                                $alt = 0;
                                foreach($values as $value): 
                                    $alt_row = $alt % 2;
                                    $alt_rows = ($alt_row == 1)? 'alternate-row': '';
                            ?>
                            <tr class="<?php echo $alt_rows; ?>">
                                <td>
                                    <?php echo $value[$sN]['cashier_id']; ?>
                                </td>
                                <td>
                                    <?php echo $value[$sN]['name']; ?>
                                </td>
                                <td>
                                    <?php echo $value[$sN]['working_days']; ?>
                                </td>
                                <td>
                                    <?php echo $value[$sN]['hour_from']." - ".$value[$sN]['hour_to']; ?>
                                </td>
                                <td>
                                    <?php 
                                    if($value[$sN]['status']==Cashier::ACTIVE){
                                        echo "Active";
                                    }else{
                                        echo "InActive";
                                    }
                                    ?>
                                </td>
                                <td>
                                    <?php echo $value[$sN]['created']; ?>
                                </td>
                                <td class="options-width">
                                    <?php 
                                        echo $this->Html->link(' ', array('controller' => $lN, 'action' => 'edit', $value[$sN]['id']), array('title' => "Edit cashier", "class" => "icon-5 info-tooltip"));
                                        echo $this->Html->link(' ', array('controller' => $lN, 'action' => 'overtimes', $value[$sN]['id']), array('title' => "View and confirm over time for cashier", "class" => "icon-overtime info-tooltip"));
                                        echo $this->Html->link(' ',array('controller'=>$lN,'action'=>'reports',$value[$sN]['id']),array('title' => "View selling report of this cashier", "class" => "icon-report info-tooltip"));
                                        if($value[$sN]['status']==Cashier::ACTIVE){
                                            echo $this->Html->link(' ', array('controller' => $lN, 'action' => 'inactive', $value[$sN]['id']), array('onclick'=>"return confirm(\"Are you sure to disabled this customer ? \")",'title' => "Click to disable customer", "class" => "icon-active info-tooltip"));
                                        }else{
                                            echo $this->Html->link(' ', array('controller' => $lN, 'action' => 'active', $value[$sN]['id']), array('onclick'=>"return confirm(\"Are you sure to inactive this customer ?\")",'title' => "Click to active customer", "class" => "icon-disable info-tooltip"));
                                        }
                                    ?>
                                </td>
                            </tr>
                            <?php 
                                $alt++;
                                endforeach; 
                            ?>
                        </table>
			<div class="clear"></div>
                        <? if($pageOption['pageCount'] > 1): ?>	
                        <table border="0" cellpadding="0" cellspacing="0" id="paging-table">
                            <?php echo $this->element('pagination');?>       
                        </table> 
                        <? endif; ?>
                    </div>
                    <div class="clear"></div>
                </div>
            </td>
            <td id="tbl-border-right"></td>
        </tr>
        <tr>
            <th class="sized bottomleft"></th>
            <td id="tbl-border-bottom">&nbsp;</td>
            <th class="sized bottomright"></th>
        </tr>
    </table>
    <div class="clear">&nbsp;</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
            jQuery("#cashierMenu").addClass('current');
});
</script>